package com.lslands;

import org.redisson.Redisson;
import org.redisson.config.Config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class ConcurrentApplication {

    public static void main(String[] args) {
        SpringApplication.run(ConcurrentApplication.class, args);
    }


    @Bean
    public Redisson redisson() {
        //单机
        Config config = new Config();
        /*
        * useSingleServer  单机
        *  useClusterServers  集群
        * useMasterSlaveServers  主从
        *   useReplicatedServers 复制
        *   useSentinelServers 哨兵模式
        * */
        config.useSingleServer().setAddress("redis://localhost:6379").setDatabase(0);
        return (Redisson) Redisson.create(config);
    }
}
